<?php
$blogArray = ($request->getAttribute('blogArray'))?$request->getAttribute('blogArray'):false;
?>
<div class="adminDash">
<?php
include(VIEW_PATH."Menu.php");
?>
<div align="center" style="height:50px; padding-top:50px;"><strong>Blogs</strong></div>
<div>
	<table width="70%" border="0" align="center"  id="FormTable">
		<tr align="left">
			<th scope="col">S.N.</th>
			<th scope="col">Blog Title</th>
			<th scope="col">Description</th>
			<th scope="col">Insert Date</th>
			<th scope="col"></th>
		</tr>
		<?php
		$i=1;
        if($blogArray) {
            foreach($blogArray as $blogVal) {
              ?>
            	<tr>
            		<td><?php echo $i?></td>
            		<td><?php echo $blogVal["title"]?></td>
            		<td><?php echo $blogVal["description"]?></td>
            		<td><?php echo $blogVal["entedate"]?></td>
            		<td><a href="<?php echo $request->createURL("Blog","del", "id={$blogVal["blogid"]}")?>">Delete</a></td>
            	</tr>
		<?php 
		      $i++;
		    }
		}
		else {
		    echo "<tr><td colspan=4>No blogs!!</td></tr>";
		}
		?>
		<tr>
			<td colspan="2"><a href="<?php echo $request->createURL("Blog","add")?>">Add New Blog</a></td>
			<td colspan="2"><?php Paging::numberPaging($request->getAttribute("noOfRecords"), $request->getAttribute("fr"), $request->getAttribute("pagingSize"));?></td>
		</tr>
	</table>
</div>

</div>
